package com.orhon.smartcampus.modules.base.mm;


import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.entity.Schools;
import com.orhon.smartcampus.modules.base.gqlModel.GQLSchool;

@Mapper(
    uses = {
        LangMapper.class,
        DictionaryMapper.class,
        RegionMapper.class
    }
)
public interface SchoolMapper {

    SchoolMapper MAPPER = Mappers.getMapper(SchoolMapper.class);


    
    
    @Mapping(source = "id" , target = "id")
    @Mapping(source = "school_slug" , target = "slug")
    @Mapping(source = "school_number" , target = "school_number")
    @Mapping(source = "icon" , target = "icon")
    @Mapping(source = "school_order" , target = "school_order")
    @Mapping(source = "header_img" , target = "header_img")
    @Mapping(source = "main_color" , target = "main_color")
    @Mapping(source = "mark" , target = "mark")
    @Mapping(source = "cloud_status" , target = "cloud_status")
    @Mapping(source = "school_client_key" , target = "client_key")
    @Mapping(source = "client_secret" , target = "client_secret")
    @Mapping(source = "orhonedu_base" , target = "orhonedu_base")
    @Mapping(source = "lng" , target = "lng")
    @Mapping(source = "lat" , target = "lat")
    @Mapping(source = "address" , target = "address")
    @Mapping(source = "created_at" , target = "created_at")
    @Mapping(source = "updated_at" , target = "updated_at")
    @Mapping(source = "deleted_at" , target = "deleted_at")
    @Mapping(source = "school_name" , target = "name")//lang
    @Mapping(source = "introduction" , target = "introduction")//lang
    @Mapping(source = "province_id" , target = "province_id", qualifiedByName = "str2reg")//地区
    @Mapping(source = "city_id" , target = "city_id", qualifiedByName = "str2reg")//地区
    @Mapping(source = "district_id" , target = "district_id", qualifiedByName = "str2reg")//地区
    @Mapping(source = "region_id" , target = "region_id", qualifiedByName = "str2reg")//地区
    @Mapping(source = "school_type" , target = "school_type", qualifiedByName = "str2dic")//数据字典
    @Mapping(ignore = true, target = "parent" )
    @Mapping(ignore = true, target = "modules" )
    @Mapping(ignore = true, target = "users" )
    @Mapping(ignore = true, target = "students" )
    @Mapping(ignore = true, target = "teachers" )
    @Mapping(ignore = true, target = "settings" )
    @Mapping(ignore = true, target = "type" )
    GQLSchool toSchool(Schools entity);
    
    @InheritConfiguration(name = "toSchool")
    List<GQLSchool> toSchoolList(List<Schools> entities);
//
//
//
//    @Named("province")
//    default GQLRegion convertProvice(Integer pid){
//    	
//    	return new GQLRegion();
//    }
//
//
//    @Named("dictionary")
//    default GQLDictionary convertDictionary(Integer pid){
//        return new GQLDictionary();
//    }



}
